package com.example.teliaCellInfo;

import android.app.Activity;
import android.content.Intent;
import android.widget.Toast;

public class SendToMail {
	Activity activity;

	public SendToMail(Activity activity) {
		this.activity = activity;
	}

	public void sendMail(String emailAddress, String subject, String message) {
		if(emailAddress.isEmpty()){
			Toast.makeText(activity, "Type the email please!!", Toast.LENGTH_LONG).show();
		}else{
		Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
		emailIntent.setType("message/rfc822");
		emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { emailAddress });
		emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
		emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);		
		try {
		    activity.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
		} catch (android.content.ActivityNotFoundException ex) {
		    Toast.makeText(activity, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
		}
		}
		
		
		
	}
}
